package com.woniu.server.controller;


import com.woniu.common.utils.ResponseData;
import com.woniu.server.dto.ApplicationDto;
import com.woniu.server.service.ProjectApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author hht
 * @Date Create by 2024/11/22 16:40
 */
@RestController
@RequestMapping("/application")
public class ApplicationController {

    @Autowired
    private ProjectApplicationService projectApplicationService;

    @PostMapping("/addApplication")
    public ResponseData<?> addApplication(@RequestBody ApplicationDto applicationDto){
        return projectApplicationService.addApplication(applicationDto);
    }

    /**
     * 查询所有客户
     * @Author hht
     * @Date Create by 2024/11/23 9:59
     */
    @GetMapping("/queryAllCustomer")
    public ResponseData<?> queryAllCustomer(){
        return projectApplicationService.queryAllCustomer();
    }

    /**
     * 通过客户code值查询对应的所有项目
     * @Author hht
     * @Date Create by 2024/11/23 10:59
     */
    @GetMapping("/queryProjectListByCode")
    public ResponseData<?> queryProjectListByCode(@RequestParam("customerCode") String customerCode){
        return projectApplicationService.queryProjectListByCode(customerCode);
    }
}
